﻿Imports System.Data.OleDb
Imports DTO

Public Class XuLyDangNhapDAO

    Public Function KiemTra(ByVal user As NhanVienDTO) As DataTable
        Dim kq As New DataTable
        Dim cn As OleDbConnection
        'B1 & B2: Tao chuoi ket noi, mo ket noi bang doi tuong ket noi
        cn = DatabaseProvider.ConnectionData()
        'B3: Tao chuoi strSQL thao tac CSDL
        Dim sql As String
        sql = "select *  From NhanVien  where UserName= ? and Pass= ?"

        'B4: Thuc thi chuoi strSQL
        Dim cmd As New OleDbCommand(sql, cn)
        cmd.Parameters.Add("@TenDN", OleDbType.WChar)
        cmd.Parameters.Add("@Pass", OleDbType.WChar)
        cmd.Parameters("@TenDN").Value = user.laytenDN()
        cmd.Parameters("@Pass").Value = user.LayPass()
        Dim a As New OleDb.OleDbDataAdapter
        a.SelectCommand = cmd
        a.Fill(kq)
        cn.Close()
        Return kq
    End Function

End Class
